package com.bonc.test.innerclass;

/**
 * 该类中的描述重点是：1、 内部类访问私有变量 2、内部类变量创建实例的语法格式
 * 
 * @author caiqiang
 * @version 2017年3月6日
 * @see Out
 * @since
 */
class Out {

    // private int age;
    //
    // public class In {
    //
    // void print() {
    // System.out.println("访问外部类的变量" + age);
    // }
    // }

    // 当局部变量、内部类变量和外部类类变量相同时，注意访问方式

    // private String content = "i'm out class field";
    //
    // public class In {
    // String content = "i'm inner class field";
    //
    // public void print() {
    //
    // String content = "i'm method field";
    // System.out.println("content ====>" + content);
    // System.out.println("this.content ====>" + this.content);
    // System.out.println("Out.this.content ====>" + Out.this.content);
    //
    // }
    // }

    // 静态内部类
    // private static String content = "i'm out class field";
    //
    // static class Inner {
    // public void print() {
    // System.out.println(content);
    // }
    // }

    // 私有内部类 这里控制内部类只能由外部类来访问了
    // private String content = "i'm out class field";
    //
    // private class Inner {
    // public void print() {
    // System.out.println("content ===>" + content);
    // }
    // }
    //
    // public void outPrint() {
    // new Inner().print();
    // }

    // 方法内部类
    private String content = "i'm out class field";

    public void print() {

        class inner {
            public void print() {
                System.out.println("content ==>" + content);
            }
        }

        new inner().print();
    }

    private static void longMethodParam(inner in) {

        System.out.println(in.getS1());
    }

    private class inner {

        private String s1;

        private String s2;

        private String s3;

        private String s4;

        private String s5;

        private String s6;

        public inner(String s1, String s2, String s3, String s4, String s5, String s6) {
            this.s1 = s1;
            this.s2 = s2;
            this.s3 = s3;
            this.s4 = s4;
            this.s5 = s5;
            this.s6 = s6;
        }

        public String getS1() {
            return s1;
        }

        public void setS1(String s1) {
            this.s1 = s1;
        }

        public String getS2() {
            return s2;
        }

        public void setS2(String s2) {
            this.s2 = s2;
        }

        public String getS3() {
            return s3;
        }

        public void setS3(String s3) {
            this.s3 = s3;
        }

        public String getS4() {
            return s4;
        }

        public void setS4(String s4) {
            this.s4 = s4;
        }

        public String getS5() {
            return s5;
        }

        public void setS5(String s5) {
            this.s5 = s5;
        }

        public String getS6() {
            return s6;
        }

        public void setS6(String s6) {
            this.s6 = s6;
        }

    }

    public static void main(String[] args) {
        longMethodParam(new Out().new inner("1", "2", "3", "4", "5", "6"));
    }

}